﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace yule.Util
{
    /// <summary>
    /// 生产唯一标示Id
    /// </summary>
    public class Id
    {
        /// <summary>
        /// 获取新Id
        /// </summary>
        /// <returns></returns>
        public static string NewId()
        {
            return System.Guid.NewGuid().ToString("N").ToUpper();
        }

        /// <summary>
        /// 判断是否是生产的Id
        /// </summary>
        /// <returns></returns>
        public static bool IsId(string id)
        {
            if (id == null || id.Length != 36) return false;
            Guid guid = System.Guid.Empty;
            System.Guid.TryParse(id, out guid);
            return guid != System.Guid.Empty;
        }

    }
}